package com.by.component.contract.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

@Getter
@AllArgsConstructor
public enum ContractSignSceneTypeEnum {

    COURSE_PLAN(ContractSignSceneTypeEnum.COURSE_PLAN_CODE, "课程服务方案"),
    REFUND_ORDER(ContractSignSceneTypeEnum.REFUND_ORDER_CODE, "订单退款申请"),
    ;

    private Integer code;
    private String desc;

    private static final Map<Integer, ContractSignSceneTypeEnum> MAP = Arrays.stream(ContractSignSceneTypeEnum.values())
            .collect(Collectors.toMap(ContractSignSceneTypeEnum::getCode, Function.identity()));

    public static ContractSignSceneTypeEnum resolve(Integer code) {
        return MAP.get(code);
    }

    public static final int COURSE_PLAN_CODE = 1;
    public static final int REFUND_ORDER_CODE = 2;
    public static final int INVESTMENT_CODE = 3;

}
